<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/common-include.jsp" %>
<style type="text/css">
table{
	border-collapse: collapse;
	border: none;
	width: 100%;
	background-color: #F9F9F9;
	color:#575757;
}

td {
	border: solid #CACACA 1px;
}
</style>
<script>
$(function(){
	//选中当前行的checkbox
	$("tr").each(function(){
		var e = $(this).children("td").children(":checkbox");
		var tr=$(this);
		$(this).find("td").each(function(index){
			if(index==2){
				$(this).click(function(){
					if(e[0].checked) {
						selectOnly();
						e.attr("checked", false);
						tr.css("background-color", "#F9F9F9");
					} else {
						selectOnly();
						e.attr("checked", true);
						tr.css("background-color", "#FFFFCC");
					}
					initTaskTab();
				});
				$(this).hover(function(){
					if(!e[0].checked) {
						tr.css("background-color", "#E8EEF7");
					}
				}, function(){
					if(!e[0].checked) {
						tr.css("background-color", "#F9F9F9");
					}
				});
			}
		});
	});
	//点击checkbox
	$(":checkbox").click(function(){
		var tr=$(this).parent().parent();
		if($(this).attr("checked")=="checked"){
			tr.css("background-color", "#FFFFCC");
		}else{
			tr.css("background-color", "#F9F9F9");
		}
		initTaskTab();
	});
});

function selectOnly(){
	$(":checkbox").removeAttr('checked');
	$("tr").css("background-color", "#F9F9F9");
}

</script>
<table>
<c:forEach var="item" items="${tasks}" varStatus="status"> 
<tr>
<c:choose>
	<c:when test="${item.priority==1}"><td width="10px" height="30px" bgcolor="#EA5200"></td></c:when>
	<c:when test="${item.priority==2}"><td width="10px" height="30px" bgcolor="#0060BF"></td></c:when>
	<c:when test="${item.priority==3}"><td width="10px" height="30px" bgcolor="#359AFF"></td></c:when>
	<c:otherwise><td width="10px" height="30px" ></td></c:otherwise>
</c:choose>

<td width="10px">
<input type="checkbox" value="${item.id }" name="selectTask" id="box_${item.id }" />
</td>

<td>
<c:choose>
	<c:when test="${item.isOver }">
		<span><u><b>${item.taskName } ${item.startTimeStr }</b></u></span>
	</c:when>
	<c:otherwise><span>${item.taskName } ${item.startTimeStr }</span></c:otherwise>
</c:choose>
</td>
<input type="hidden" id="item_id_${item.id }" value="${item.id }" />
<input type="hidden" id="item_name_${item.id }" value="${item.taskName }" />
<input type="hidden" id="item_priority_${item.id }" value="${item.priority }" />
<input type="hidden" id="item_startTime_${item.id }" value="${item.startTimeStr }" />
<input type="hidden" id="item_note_${item.id }" value="${item.note }" />
<%-- <input type="hidden" id="item_${item.id }" value="${item.id }&${item.taskName }&${item.priority}&${item.startTimeStr }"/>
<input type="hidden" id="note_${item.id }" value="${item.note }"/> --%>
</tr>
</c:forEach>
</table>
